package com.example.service.impl;

import cn.binarywang.tools.generator.ChineseIDCardNumberGenerator;
import cn.binarywang.tools.generator.ChineseMobileNumberGenerator;
import cn.binarywang.tools.generator.ChineseNameGenerator;
import cn.hutool.core.util.RandomUtil;
import com.example.demodao.entity.TbInfo;
import com.example.demodao.mapper.TbInfoMapper;
import com.example.service.TbInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author rosszhang
 * @since 2023-02-24
 */
@Service
public class TbInfoServiceImpl extends ServiceImpl<TbInfoMapper, TbInfo> implements TbInfoService {

    @Override
    public void addInfo() {
        //随机生成身份证
        String id = ChineseIDCardNumberGenerator.getInstance().generate();
        //随机生成手机号码
        String mobilePhoneNo = ChineseMobileNumberGenerator.getInstance().generate();
        // 随机生成姓名
        String name = ChineseNameGenerator.getInstance().generate();
        TbInfo addInfo = new TbInfo();
        addInfo.setName(name);
        addInfo.setAge(RandomUtil.randomInt(100));
        addInfo.setStature(RandomUtil.randomInt(200));
        this.baseMapper.insert(addInfo);

    }
}
